<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;hidden;margin:0;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=A520d6e719ae20b0b51c28245bd04f9a"></script>
<title>添加普通标注点</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">

// 百度地图API功能
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point(116.404, 39.915), 14);

var pointJson = {'x':116.384,'y':39.925};
var polygonJson =[{"lng":116.404,"lat":39.915},{"lng":116.370,"lat":39.935},{"lng":116.414,"lat":39.925}];

var pointObj = eval(pointJson);
var polygonObj = eval(polygonJson);
var marker = new BMap.Marker(new BMap.Point(pointObj.x, pointObj.y));  // 创建标注
map.addOverlay(marker);              // 将标注添加到地图中


var pointArray = [];
for (var i = 0; i < polygonObj.length; i++) {
        
        var lastPoint = new BMap.Point(polygonObj[i].lng, polygonObj[i].lat);
        pointArray.push(lastPoint);
       
    }
var polygon = new BMap.Polygon(pointArray);
map.addOverlay(polygon);

</script>
